#shader vertex
#version 330 core
layout( location = 0 ) in vec4 a_position;
layout( location = 1 ) in vec4 a_color;
layout( location = 2 ) in vec2 a_uv;
layout( location = 3 ) in float a_tex_id;

out vec4 v_color;
out vec2 v_uv;
out float v_tex_id;
uniform mat4 u_mvp; //matrix view

void main(){
    v_color = a_color;
    v_uv = a_uv;
    v_tex_id = a_tex_id;
    gl_Position = u_mvp * a_position;
}


#shader fragment
#version 330 core
layout (location=0) out vec4 outColor;

in vec4 v_color;
in vec2 v_uv;
in float v_tex_id;
uniform vec4 u_color;
uniform sampler2D u_texture[2];

void main(){
    int index = int( v_tex_id );
    vec4 color = u_color * v_color * texture( u_texture[index], v_uv );
    outColor = color;
    //outColor = vec4( v_tex_id, v_tex_id, v_tex_id, 1.0 );
    //outColor = vec4( v_uv.x, v_uv.y, 0.0, 1.0 );
}
